package com.rui.study.algorithm.P_单链表反转;


import com.rui.study.algorithm.ListNode;

public class Solution_3 {

    public ListNode reverseList(ListNode head) {
        ListNode pre = null;
        ListNode cur = head;
        ListNode tmp;
        while (cur != null) {
            tmp = cur.next;

            cur.next = pre;
            pre = cur;

            cur = tmp;
        }
        return pre;
    }
}
